<?php
// +----------------------------------------------------------------------
// | Quotes [ 只为给用户更好的体验]**[我知道发出来有人会盗用,但请您留版权]
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 零度  <2109877665@qq.com>          盗用不留版权,你就不配拿去!
// +----------------------------------------------------------------------
// | Date: 2019年08月20日
// +----------------------------------------------------------------------

/**
 * 三方设置
**/
$title='支付设置';
include './Head.php';
	foreach ($Instant_Url_List as $key => $val) {
			$checkServerSatatus = checkServerSatatus($Instant_Url_List[$key]);
			$select.= '<option value="'.$Instant_Url_List[$key].'">【'.($key+1).'号】['.$checkServerSatatus['Country'].'] (ms:'.$checkServerSatatus['Ping'].')(ip:'.$checkServerSatatus['IP'].')</option>';
	}
	if(!$select)$select = '<option value="/">0_无服务器(ms:9999)</option>';
?>
<!-- APP MAIN ==========-->
		<div class="row">
			<div class="col-sm-3 col-md-3">
				<div class="panel">
					<div class="panel-heading">
						<h4 class="panel-title">平台基本设置</h4>
					</div>
					<div class="panel-body">
					<form onsubmit="return saveSetting(this)" method="post" class="form-horizontal" role="form">
							<div class="form-group">
                                <label>网站名称</label>
                                <input type="text" id="sitename" name="sitename" value="<?=$conf['sitename']?>" class="form-control">
                            </div>
							<div class="form-group">
                                <label>标题栏后缀</label>
                                <input type="text" id="title" name="title" value="<?=$conf['title']?>" class="form-control">
                            </div>
							<div class="form-group">
                                <label>关键字</label>
                                <input type="text" id="keywords"  name="keywords" value="<?=$conf['keywords']?>" class="form-control">
                            </div>
							<div class="form-group">
                                <label>网站描述</label>
                                <input type="text" id="description" name="description" value="<?=$conf['description']?>" class="form-control">
                            </div>
							<div class="form-group">
                                <label>后台帐号</label>
                                <input type="text" id="admin_user" name="admin_user" value="<?=$conf['admin_user']?>" class="form-control">
                            </div>
							<div class="form-group">
                                <label>后台密码</label>
                                <input type="text" id="admin_pass" name="admin_pass" value="<?=$conf['admin_pass']?>" class="form-control">
                            </div>
				</div>
			</div>
			</div>
			
			<div class="col-sm-6 col-md-6">
				<div class="panel">
					<div class="panel-heading">
						<h4 class="panel-title">金额浮动云端计算设置</h4>
					</div>
					<div class="panel-body">
				<table class="table table-bordered table-striped">
		    <thead><tr><th class="danger">服务器/“PID”_“KEY”</th><th class="danger">额度/状态</th></thead>
			<tbody>
			  <tr><td><div class="col-sm-10"><select class="form-control" id="Instant_url" name="Instant_url" default="<?php echo $conf['Instant_url']; ?>"><?=$select?></option></select>
			  <?php $Query_row = $Instant_Api->Query();?>
			  </td><td><div class="col-sm-10"><input type="text" id="" name="" value="请选择响应最快的服务器" class="form-control" disabled>
			  
			  </td></tr>
			  </td><td><div class="col-sm-10"><input type="text" id="Instant_pid" name="Instant_pid" value="<?php echo $conf['Instant_pid']; ?>" class="form-control" placeholder=""/>
			  </td><td><div class="col-sm-10"><input type="text" id="" name="" value="额度：<?php echo $Query_row['paymb']; ?>" class="form-control" disabled>
			  </td></tr>
			  </td><td><div class="col-sm-10"><input type="text" id="Instant_key" name="Instant_key" value="<?php echo $conf['Instant_key']; ?>" class="form-control" placeholder=""/>
			  </td><td><div class="col-sm-10"><a class="form-control"><span class="glyphicon glyphicon-globe"></span>状态：<?=($Query_row['paymb']>=1?'<font color="green">正常</font>':'<font color="red">异常</font>')?></a>
			  </td></tr>
			</tbody>
          </table>
					</div>		
					<div class="panel-heading">
						<h4 class="panel-title"><span class="glyphicon glyphicon-globe"></span> 官方提醒</h4>
					</div>
					<div class="panel-body">
							<div class="form-group">
                                <label>PS：</label>
								<br>
								1.此设置不懂的就不要乱去修改,否则会出现系统不出码子的情况<br>
								2.此设置是官方设置,作用是利用接口计算金额浮动去匹配二维码<br>
								2.如果状态一旦显示"<font color="red">状态异常</font>"则尽快联系官方进行维护修复!<br>
				</div>
			</div>
			</div>
			</div>
			<div class="col-sm-2 col-md-2">
				<div class="panel">
					<div class="panel-heading">
						<h4 class="panel-title">邮箱设置</h4>
					</div>
					<div class="panel-body">
							<div class="form-group">
                                <label>发件方式</label>
                                <select class="form-control m-b" id="mail_type" name="mail_type">
                                    <option value="<?=$conf['mail_type']?>"><?=$conf['mail_type']?></option>
                                    <option value="本地发件一">本地发件一</option>
                                    <option value="本地发件二">本地发件二</option>
                                    <option value="接口发件">接口发件</option>
                                </select>
								<pre><font color="green">如果获取验证码出现服务器错误,请选择接口发件,本地发件需要PHP5.5</font></pre>
							</div>
							<div class="form-group">
                                <label>邮箱SMTP地址</label>
                                <input type="text" id="mail_smtp" name="mail_smtp" value="<?=$conf['mail_smtp']?>" class="form-control">
                            </div>
							<div class="form-group">
                                <label>邮箱SMTP端口</label>
                                <input type="text" id="mail_port" name="mail_port" value="<?=$conf['mail_port']?>" class="form-control">
                            </div>
							<div class="form-group">
                                <label>邮箱账号</label>
                                <input type="text" id="mail_name" name="mail_name" value="<?=$conf['mail_name']?>" class="form-control">
                            </div>
							<div class="form-group">
                                <label>邮箱密码（授权码）</label>
                                <input type="text" id="mail_pwd" name="mail_pwd" value="<?=$conf['mail_pwd']?>" class="form-control">
				</div>
				</div>
			</div>
			</div>
			</div>
		<div class="row">
			<div class="col-sm-4 col-md-4">
				<div class="panel">
					<div class="panel-heading">
						<h4 class="panel-title">其他设置</h4>
					</div>
					<div class="panel-body">
							<div class="form-group">
                                <label>授权商公共</label>
								<textarea id="gonggao" name="gonggao" class="form-control"><?=$conf['gonggao']?></textarea>
					</div>
							<div class="form-group">
                                <label>收款检测时间(单位:秒)</label>
                                <input type="text" id="cron_time" name="cron_time" value="<?=$conf['cron_time']?>" class="form-control">
								<pre><font color="green">推荐10秒,这个是用于自动回调的</font></pre>
				</div>
				</div>
			</div>
			</div>
			
			
			
			<div class="col-sm-4 col-md-4">
				<div class="panel">
					<div class="panel-heading">
						<h4 class="panel-title">自助购买对接支付配置</h4>
					</div>
					<div class="panel-body">
							<div class="form-group">
                                <label>支付地址</label>
                                <input type="text" id="pay_url" name="pay_url" value="<?=$conf['pay_url']?>" class="form-control">
                            </div>
							<div class="form-group">
                                <label>支付pid</label>
                                <input type="text" id="pay_pid" name="pay_pid" value="<?=$conf['pay_pid']?>" class="form-control">
                            </div>
							<div class="form-group">
                                <label>支付key</label>
                                <input type="text" id="pay_key" name="pay_key" value="<?=$conf['pay_key']?>" class="form-control">
				</div>
				</div>
			</div>
			</div>
			
			<div class="col-sm-4 col-md-4">
				<div class="panel">
					<div class="panel-heading">
						<h4 class="panel-title">自助购买价格设定</h4>
					</div>
					<div class="panel-body">
							<div class="form-group">
                                <label>授权自助购买价格</label>
                                <input type="text" id="pay_money" name="pay_money" value="<?=$conf['pay_money']?>" class="form-control">
                            </div>
							<div class="form-group">
                                <label>额度充值比例(1000额度=?¥)</label>
                                <input type="text" id="ed_money" name="ed_money" value="<?=$conf['ed_money']?>" class="form-control">
                            </div>
							<div class="form-group">
                                <label>支付宝自动更新(?¥/月)</label>
                                <input type="text" id="alipay_up_money" name="alipay_up_money" value="<?=$conf['alipay_up_money']?>" class="form-control">
				</div>
							<div class="form-group">
                                <label>PC挂机软件授权(?¥/永久)</label>
                                <input type="text" id="pc_check_money" name="pc_check_money" value="<?=$conf['pc_check_money']?>" class="form-control">
				</div>
				</div>
			</div>
			</div>
			<div class="col-sm-12 col-md-12">
					</div>
					<div class="panel-body">
							<div class="form-group">
								<div class="col-sm-offset-2 col-sm-10"><input type="submit" name="submit" value="保存设置" class="btn btn-primary form-control"/>
							</div>
                        </form>
					</div>
				</div>
			</div>
	
		</div><!-- .row -->
<script src="//cdn.staticfile.org/layer/2.3/layer.js"></script>
  <script type="text/javascript">
		
var items = $("select[default]");
for (i = 0; i < items.length; i++) {
	$(items[i]).val($(items[i]).attr("default")||0);
}
function saveSetting(obj){//修改信息
		  	var ii = layer.load(3, {shade:[0.1,'#fff']});
		  	$.ajax({
				type : "POST",
				url : "Ajax.php?act=Set",
				data : $(obj).serialize(),
				dataType : 'json',
				timeout:10000,
				success : function(data) {					  
					  layer.close(ii);
					  if(data.code==1){
						layer.alert('设置保存成功！', {
							icon: 1,
							closeBtn: false
						}, function(){
							window.location.reload()
						});
					  }
				},
				error:function(data){
					layer.close(ii);
					layer.msg('服务器错误');
					}
			});
		  	
}
  </script>